public class reverseString {
    public static String reverseString(String nums){
        char[] chars = nums.toCharArray();
        int left = 0;
        int right = chars.length-1;
        while(left < right){
            char tmp = chars[left];
            chars[left] = chars[right];
            chars[right] = tmp;
            left++;
            right--;
        }
//        return chars.toString();
        return new String(chars);
    }
    public static String reverseString1(String nums){
//        char[] chars = nums.toCharArray();
        StringBuilder sb = new StringBuilder(nums);
        return sb.reverse().toString();
    }

    public static void main1(String[] args){
        String nums = "hello";
        System.out.println(reverseString(nums));
    }
}
